<!-- Main content -->
@extends('layouts.default')
@section('css')
    <link rel="stylesheet" href="{{asset('admin-lte/plugins/datatables/dataTables.bootstrap4.css')}}">
    {{--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">--}}
    <style>
        .help-block-error{
            color:red;
        }
        table th,table td{
            font-size:14px!important;
        }
    </style>
@stop

@section('content')
    <div class="row">
        <div class="col-12">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">提现管理 / <a class="text-primary" href="{{url('admin/cash/index')}}">提现列表</a></h3>
                </div>

                <div class="card-body">
                        <div class="card-body">
                            @include('layouts.message')
                            <table id="example1" class="table table-bordered table-striped">
                                <thead>
                                <tr>
                                    <th>操作</th>
                                    <th>用户名</th>
                                    <th>提现金额</th>
                                    <th>手机号</th>
                                    <th>支付宝账号</th>
                                    <th>申请提现时间</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach ($list as $cash)
                                    <tr>
                                        <td>
                                            @if($cash['status'] == 1)
                                               <span style="color:blue">已提现</span>
                                            @else
                                                <button class="btn btn-sm btn-success" id="cash" data-url="{{url('admin/cash/docash',['id'=>$cash['id']])}}">提现</button>
                                            @endif

                                        </td>
                                        <td>{{ $cash['true_name'] }}</td>
                                        <td>{{ $cash['money'] }}</td>
                                        <td>{{ $cash['phone'] }}</td>
                                        <td>{{ $cash['alipay_account'] }}</td>
                                        <td>{{ $cash['created_at'] }}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                                <tfoot>
                                    <tr>
                                        <td colspan="8"></td>
                                    </tr>
                                </tfoot>
                            </table>
                        </div>
                </div>
            </div>
        </div>
    </div>

@stop



@section('script')
    <script src="{{asset('admin-lte/plugins/datatables/jquery.dataTables.js')}}"></script>
    <script src="{{asset('admin-lte/plugins/datatables/dataTables.bootstrap4.js')}}"></script>

    {{--layer插件--}}
    <script src='{{asset("admin-lte/plugins/layer-v3.1.1/layer.js")}}' type="text/javascript"></script>
    <script>
        $("#example1").DataTable({
            "language"  : {
                url :'https://cdn.datatables.net/plug-ins/1.10.19/i18n/Chinese.json'
            },
//            //启用或者禁用某一列的排序功能
//            "columnDefs": [
//                { "orderable": false, "targets": 0 }
//            ],

            buttons: [
                {
                    text: 'Alert',
                    action: function ( e, dt, node, config ) {
                        alert( 'Activated!' );
                        this.disable(); // disable button
                    }
                }
            ]
        });

        $('#cash').on('click',function(){
            var href = $(this).data('url');
            layer.confirm('确认要提现吗?',function(){
                location.href = href;
            })
        })
    </script>
@stop
